/**
 * Anderground project - Subway maps processor application.
 * Copyright (C) 2008-2009 Eldar Abusalimov, Ilya Shurigyn
 * 
 * This file is part of Anderground.
 * 
 * Anderground is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * Anderground is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Anderground.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.anderground.core.drawer;

import org.anderground.core.graphics.Point;
import org.anderground.core.graphics.PointF;
import org.anderground.core.util.Coord;
import org.anderground.core.util.Coordinated;

/**
 * This class provides a two-side conversion between screen pixels and real
 * coordinates
 * 
 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
 */
public interface Calculator {

	/**
	 * @author Eldar Abusalimov (eldar.abusalimov@gmail.com)
	 */
	public static enum Mode {
		POSITION, LOCATION
	}

	/**
	 * Converts a lat/lon (or an abs/ord) pair to an x/y screen-pixel pair.
	 * 
	 * @param coord
	 *            The point containing the pair to convert.
	 * @param pointF
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(Coord coord, PointF pointF);

	/**
	 * Converts a lat/lon (or an abs/ord) pair to an x/y screen-pixel pair.
	 * 
	 * @param coord
	 *            The point containing the pair to convert.
	 * @param point
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(Coord coord, Point point);

	/**
	 * Helper for a quick access to coordinated's coordinates
	 * 
	 * @param coordinated
	 * @param pointF
	 */
	public abstract void convert(Coordinated coordinated, PointF pointF);

	/**
	 * Helper for a quick access to station's coordinates
	 * 
	 * @param coordinated
	 * @param point
	 */
	public abstract void convert(Coordinated coordinated, Point point);

	/**
	 * Converts a float-pair to another float-pair.
	 * 
	 * @param coordF
	 *            The point containing the pair to convert.
	 * @param pointF
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(PointF coordF, PointF pointF);

	/**
	 * Converts a float-pair to an x/y screen-pixel pair.
	 * 
	 * @param coordF
	 *            The point containing the pair to convert.
	 * @param point
	 *            a point where the pixel x/y will be stored.
	 */
	public abstract void convert(PointF coordF, Point point);

	/**
	 * reverse method for converting screen pixels to float-pair
	 * 
	 * @param point
	 * @param coordF
	 */
	public abstract void revert(Point point, PointF coordF);

	/**
	 * reverse method for converting screen pixels to float-pair
	 * 
	 * @param pointF
	 * @param coordF
	 */
	public abstract void revert(PointF pointF, PointF coordF);

	/**
	 * Delegates an appropriate coordinates getter of the coordinated
	 * 
	 * @param coordinated
	 * @return
	 */
	public abstract Coord getCoord(Coordinated coordinated);

	/**
	 * Calculation mode
	 * 
	 * @return
	 */
	public abstract Mode getMode();

}
